'''
Funcion:
    定义游戏角色
author:
    walker
time:
    2020/5/10
'''
from role import *
from config import *

'''关卡一'''
class create_level():
    def __init__(self):
        self.info = 'level1'

    '''创建墙'''
    def setup_walls(self,wall_positions):
        self.wall_sprites = pygame.sprite.Group()
        for wall_position in wall_positions:
            wall = Wall(*wall_position)
            self.wall_sprites.add(wall)
        return self.wall_sprites

    '''创建玩家角色'''
    def set_player(self,acorn_path,start_pos):
        self.acorn_sprites = pygame.sprite.Group()
        self.acorn_sprites.add(Player(start_pos[0],start_pos[1],acorn_path))
        return self.acorn_sprites

    '''创建水火'''
    def set_water_fire(self,path,pos):
        self.water_fire_sprites = pygame.sprite.Group()
        for pos_item in pos:
            water_fire = charactor(*pos_item,path)
            self.water_fire_sprites.add(water_fire)
        return self.water_fire_sprites

    '''创建终点'''
    def set_final(self,path,pos):
        self.final_sprites = pygame.sprite.Group()
        self.final_sprites.add(charactor(*pos,path))
        return self.final_sprites

    '''传送点'''
    def set_trans(self,pos):
        self.trans_sprites = pygame.sprite.Group()
        self.trans_sprites_ori = pygame.sprite.Group()
        for pos_item in pos[:2]:
            trans = charactor(*pos_item,TRANS_ONE_PATH)
            self.trans_sprites.add(trans)
            self.trans_sprites_ori.add(trans)
        for pos_item in pos[2:]:
            trans = charactor(*pos_item,TRANS_TWO_PATH)
            self.trans_sprites.add(trans)
            self.trans_sprites_ori.add(trans)
        return self.trans_sprites,self.trans_sprites_ori
